clear all
set more off, perm
global cd "/mnt/brownresearch/ECON_LaPorta/rlaporta/research/BGLS2023"
global Tables $cd/TS/Tables
global Data   $cd/TS/DataForTables
* *******************************************
set varabbrev off
* *******************************************
use $Data/TimeSeries01, clear
* *******************************************
* Table 1
* *******************************************
keep if r1+r5<.
keep if dofm(datem)<mdy(1,1,2016)
* MUST ADD statement requiring sample size to be 1981:12+
foreach var of varlist LTG LTGR STGE1 STGE2 STGE2R r1 r3 r5 e_cae3 xret* xRet* {
	egen `var'std=std(`var')
	replace `var'=`var'std
	drop `var'std
}
tsset datem
foreach var of varlist LTG STGE1 STGE2 {
eststo clear
forvalues x=1(2)5 {
	local j=`x'*12
	* run OLS to get R squared
	quietly: regress r`x'  `var'	if lnret1+lnret5<. & statpers>=mdy(12,1,1981) & statpers<., robust
	local rsqr=e(r2_a)	

	quietly: eststo: quietly: newey2  r`x'  `var'	if lnret1+lnret5<. & statpers>=mdy(12,1,1981) & statpers<., lag(`j') force
	quietly estadd scalar ar2=`rsqr'	
	}
	esttab, b(4) se(4) scalar(ar2)
	if "`var'"=="LTG" {
	esttab using $Tables/Table1.csv, unstack drop(_cons) nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) nogaps scalar(ar2) title("Table 1") replace
		}
	else {
	esttab using $Tables/Table1.csv, unstack drop(_cons) nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) nogaps scalar(ar2) title("Table 1") append
		}
}
* *******************************************
* Appendix B1 -- Panels A through D (i.e., dep variable is PV ln excess returns) 
* Note: Very small differences in the coefficients for LTGR and STGE2R relative to printed version
foreach var of varlist LTG LTGR STGE2 STGE2R {
eststo clear
forvalues x=1(2)5 {
	local j=`x'*12
	quietly: 	 regress xret`x'  `var'	if lnret1+lnret5<. & statpers>=mdy(12,1,1981) & statpers<., robust
	local rsqr=e(r2_a)	
	quietly: eststo: newey2  xret`x'  `var'	if lnret1+lnret5<. & statpers>=mdy(12,1,1981) & statpers<., lag(`j') force
	quietly estadd scalar ar2=`rsqr'	
}
esttab , unstack drop(_cons) nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) nogaps scalar(ar2)
if "`var'"=="LTG" {
esttab using $Tables/AppendixB1.csv, unstack drop(_cons) nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) nogaps scalar(ar2) title("Appendix B1. xret") replace
}
if "`var'"!="LTG" {
esttab using $Tables/AppendixB1.csv, unstack drop(_cons) nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) nogaps scalar(ar2) title("Appendix B1. xret") append
}
}
* Appendix B1 -- Panels E through H (i.e. dep variable is xRet) 
* Note: Very small differences in the coefficients for LTGR and STGE2R relative to printed version
foreach var of varlist LTG STGE1 STGE2 {
eststo clear
forvalues x=1(2)5 {
	local j=`x'*12
	quietly: 	regress	xRetYr`x'  `var'	if lnret1+lnret5<. & statpers>=mdy(12,1,1981) & statpers<., robust
	local rsqr=e(r2_a)	
	quietly: eststo: newey2	xRetYr`x'  `var'	if lnret1+lnret5<. & statpers>=mdy(12,1,1981) & statpers<., lag(`j') force
	quietly estadd scalar ar2=`rsqr'	
}
esttab , unstack drop(_cons) nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) nogaps scalar(ar2)
esttab using $Tables/AppendixB1.csv, unstack drop(_cons) nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) nogaps scalar(ar2) title("Appendix B1. Excess Raw Ret") append
}
* *********************************************
* Table 2
* *********************************************
use $Data/TimeSeries01, clear
drop if r5==. | LTG==. 
keep if dofm(datem)<mdy(1,1,2016)

generate pd=-dp
generate pe=-ep
generate spread=ln(1+yield10/100)-ln(1+yield1/100)
generate credit=ln(1+BAA/100)-ln(1+AAA/100)

foreach var of varlist r1 r3 r5  r7 LTG STGE1 dp ep spc cay svix12 spread credit bloom_uncertainty kellypruitt_mrp ExpInf expd e_cae3 {
	egen `var'std=std(`var')
	replace `var'=`var'std
	drop `var'std
}
* *********************************************
* Table 2: Panel A
* *********************************************
tsset datem
eststo clear
foreach var of varlist pd pe spc cay svix12 STGE1 {
		gen x=`var'
		quietly: 			regress r5  	x	if r1+r5<., robust
		local uni=e(r2_a)

		quietly: 			regress r5  LTG x	if r1+r5<., robust
		local biv=e(r2_a)

		quietly: eststo nwy_`var': 	newey2  r5  LTG x	if r1+r5<., lag(60) force
		estadd scalar uni=`uni' 
		estadd scalar biv=`biv'
		drop x
}
esttab,  unstack drop(_cons) nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01)label scalars(biv uni)   nogap	
esttab nwy* using $Tables/Table2.csv, unstack drop(_cons) nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01)label scalars(biv uni) nogap replace
* *********************************************
* Table 2: Panel B
* *********************************************
tsset datem
eststo clear
foreach var of varlist spread credit bloom_uncertainty kellypruitt_mrp ExpInf expd  {
		gen x=`var'
		quietly: 			regress r5  	x	if r1+r5<., robust
		local uni=e(r2_a)

		quietly: 			regress r5  LTG x	if r1+r5<., robust
		local biv=e(r2_a)

		quietly: eststo nwy_`var': 	newey2  r5  LTG x	if r1+r5<., lag(60) force
		estadd scalar uni=`uni' 
		estadd scalar biv=`biv'
		drop x
}
esttab,  unstack drop(_cons) nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01)label scalars(biv uni)   nogap	
esttab nwy* using $Tables/Table2.csv, unstack drop(_cons) nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01)label scalars(biv uni) nogap append
* *********************************************
* Appendix B2 
* *********************************************
* NOTE:  MINOR DIFFERENCES IN STANDARD ERRORS
* Appendix B2 -- Panel A1
tsset datem
eststo clear
foreach var of varlist pd pe STGE1 spc cay svix12  {
		gen Z=`var'
		quietly: 		regress r1  LTG Z	if r1+r5<., robust
		local r2_a=e(r2_a)
		quietly: eststo: 	newey2  r1  LTG Z	if r1+r5<., lag(12) force
		estadd scalar ar2=`r2_a'
		drop Z
}
esttab,unstack drop(_cons) 	nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01)label scalar(ar2) nogap	
esttab using $Tables/AppendixB2.csv ,unstack drop(_cons) nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01)label scalar(ar2) nogap title("Appendix B2: A1") replace
* *********************************************
* Appendix B2 -- Panel A2
* *********************************************
eststo clear
foreach var of varlist spread credit bloom_uncertainty kellypruitt_mrp ExpInf expd  {
		gen Z=`var'
		quietly: 		regress r1  LTG Z	if r1+r5<., robust
		local r2_a=e(r2_a)
		quietly: eststo: 	newey2  r1  LTG Z	if r1+r5<., lag(12) force
		estadd scalar ar2=`r2_a'
		drop Z
}
esttab,unstack drop(_cons) 	nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01)label scalar(ar2) nogap	
esttab using $Tables/AppendixB2.csv ,unstack drop(_cons) nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01)label scalar(ar2) nogap title("Appendix B2: A2") append	 
* *********************************************
* Appendix B2 -- Panel B1
* *********************************************
tsset datem
eststo clear
foreach var of varlist pd pe STGE1 spc cay svix12  {
		gen Z=`var'
		quietly: 		regress r3  LTG Z	if r1+r5<., robust
		local r2_a=e(r2_a)
		quietly: eststo: 	newey2  r3  LTG Z	if r1+r5<., lag(36) force
		estadd scalar ar2=`r2_a'
		drop Z
}
esttab,unstack drop(_cons) 	nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01)label scalar(ar2) nogap	
esttab using $Tables/AppendixB2.csv ,unstack drop(_cons) nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01)label scalar(ar2) nogap title("Appendix B2: B1") append 
* *********************************************
* Appendix B2 -- Panel B2
* *********************************************
eststo clear
foreach var of varlist spread credit bloom_uncertainty kellypruitt_mrp ExpInf expd  {
		gen Z=`var'
		quietly: 		regress r3  LTG Z	if r1+r5<., robust
		local r2_a=e(r2_a)
		quietly: eststo: 	newey2  r3  LTG Z	if r1+r5<., lag(36) force
		estadd scalar ar2=`r2_a'
		drop Z
}
esttab,unstack drop(_cons) 	nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01)label scalar(ar2) nogap	
esttab using $Tables/AppendixB2.csv ,unstack drop(_cons) nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01)label scalar(ar2) nogap title("Appendix B2: B2") append	 
* *********************************************
* Appendix B3 
* Note: results in the printed appendix are based on normalization over a slightly different sample
* Coefficients in printed appendix are a bit smaller
* *********************************************
eststo clear
forvalues x=1(2)5   {
		local j=12*`x'
		quietly: 		regress r`x'  e_cae3	if r1+r5<., robust
		local r2_a=e(r2_a)
		quietly: eststo: 	newey2  r`x'  e_cae3	if r1+r5<., lag(`j') force
		estadd scalar ar2=`r2_a'
}
esttab,unstack drop(_cons) 	nonotes compress b(4)  se(4) star(c 0.10 b 0.05 a 0.01)label scalar(ar2) nogap	
esttab using $Tables/AppendixB3.csv ,unstack drop(_cons) nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01)label scalar(ar2) nogap title("Appendix B3") replace	 
* *********************************************
* Table 3
* *********************************************
* Note: Update in FRED --> very small change in the values for spc 
use $Data/TimeSeries01, clear
generate spread=ln(1+yield10/100)-ln(1+yield1/100)
generate credit=ln(1+BAA/100)-ln(1+AAA/100)
generate pd=-dp
* *********************************************
keep if d1LTG<.
keep if dofm(datem)<mdy(1,1,2021)
* *********************************************
foreach var of varlist d*LTG L*LTG e_cae* d_duke01 duke01Yr pd spc cay kellypruitt_mrp svix12 PVS bloom_uncertainty gz_spr HighYieldShare spread credit lagret* {
	egen `var'std=std(`var')
	replace `var'=`var'std
	drop `var'std
}
tsset datem
eststo clear
quietly: eststo ols1: regress d1LTG L1LTG e_cae3			, robust
local r2_a=e(r2_a)
quietly: eststo fst1: newey2  d1LTG L1LTG e_cae3 			, lag(12) force
estadd scalar ar2=`r2_a'

quietly: eststo ols2: regress d1LTG L1LTG e_cae3 lagret1 duke01Yr	, robust
local r2_a=e(r2_a)
quietly: eststo fst2: newey2  d1LTG L1LTG e_cae3 lagret1 duke01Yr	, lag(12) force
estadd scalar ar2=`r2_a'

foreach x of varlist pd spc cay svix12 {
gen Z = `x'
quietly: eststo ols`x': regress d1LTG L1LTG e_cae3 Z			, robust
local r2_a=e(r2_a)
quietly: eststo fst`x': newey2  d1LTG L1LTG e_cae3 Z			, lag(12) force
estadd scalar ar2=`r2_a'
drop Z
}
esttab fst* 				, drop(_cons) nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) scalar(ar2) nogap 	
esttab fst* using $Tables/Table3.csv	, drop(_cons) nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) scalar(ar2) nogap title("Table 3") replace
* *********************************************
* Appendix B4
* Note: Version in the paper uses "ivreg2" command.  Here i am using "newey2" --> minor differences in the standard errors.
* *********************************************
eststo clear
foreach x of varlist spread credit bloom_uncertainty kellypruitt_mrp lagret5 {
gen Z = `x'
quietly: eststo ols`x': regress d1LTG L1LTG e_cae3 Z			, robust
local r2_a=e(r2_a)
quietly: eststo fst`x': newey2  d1LTG L1LTG e_cae3 Z			, lag(12) force
estadd scalar ar2=`r2_a'
drop Z
}
esttab fst* 				, drop(_cons) nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) scalar(ar2) nogap 	
esttab fst* using $Tables/AppendixB4.csv, drop(_cons) nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) scalar(ar2) nogap title("Appendix B4") replace
* *********************************************
* Table 4 --Forecast Errors
* *********************************************
* Note #1::  Below I have a slight inconsistency in the size of the sample used to normalize variables (i.e. same variables are normalized before the "keep if d1LTG+errorLTGA <." statement; others after"
* Note #2: The bandwidth (bw) should be n+1.  For example, i should use "bw(61)" rather than "bw(60)" and "bw(37)" rather than "bw(36)"
use datem LTG r3 r5 Actual* errorLTG* e_cae3 ST* dp  if dofm(datem)>=mdy(12,1,1981) using /srv/Feb2023/TimeSeries01, clear
keep if dofm(datem)<mdy(1,1,2016)
generate pd=-dp
label var errorLTG3 "3-year FE"
label var errorLTGB "5-year FE"

foreach var of varlist r3 r5 errorLTGA errorLTGB errorLTG3 errorLTG7 ST* e_cae3 LTG pd {
	egen `var'std=std(`var')
	replace `var'=`var'std
	drop `var'std
}
tsset datem
gen L1LTG=L12.LTG
gen d1LTG=LTG-L1LTG
*********
eststo clear
tsset datem

keep if d1LTG+errorLTGA <.
foreach var of varlist r5 r3 {
	egen `var'std=std(`var')
	replace `var'=`var'std if `var'<.
	drop `var'std
}
*********
eststo clear
eststo: quietly: ivreg2  	errorLTGB 	d1LTG L1LTG			, bw(61) small robust
predict fit if e(sample)

eststo: quietly: ivreg2  	r5 		d1LTG L1LTG			, bw(61) small robust

eststo: quietly: ivreg2  	r5 		(errorLTGB=d1LTG L1LTG)		, bw(61) small robust
weakivtest	
local MF=r(F_eff) 
estadd scalar MF=`MF'
eststo: quietly: ivreg2  	r5 		fit pd				, bw(61) robust small  first
*********
esttab *			 , nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) nolabel stats(N r2_a MF)	 
esttab * using $Tables/Table4.csv, nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) nolabel stats(N r2_a MF) nogap title("Table 4") replace
drop fit
*************************************
* Appendix B5 --Forecast Errors
*************************************
eststo clear
eststo  top1: quietly: ivreg2  	errorLTG3 	d1LTG L1LTG			, bw(37) robust
predict fit if e(sample)

eststo  top2: quietly: ivreg2  	r3 		d1LTG L1LTG			, bw(37) robust

eststo  top3: quietly: ivreg2  	r3 		(errorLTG3=d1LTG L1LTG)		, bw(37) robust
weakivtest	
local MF=r(F_eff) 
estadd scalar MF=`MF'

weakiv ivregress 2sls 		r3 		(errorLTG3=d1LTG L1LTG)		, vce(hac nw 37) small md

eststo  top5: quietly: ivreg2  	r3 		fit pd				, bw(37) robust first
*********
esttab *			, nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) nolabel stats(N r2_a MF)	 
esttab * using $Tables/AppendixB5.csv, nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) nolabel stats(N r2_a MF) nogap title("Appendix B5") replace
drop fit
*************************************
* Appendix B6 --Forecast Errors
*************************************
eststo clear
eststo: quietly: ivreg2  	d1LTG 		e_cae3				, bw(13) small robust
	predict fitrevision if e(sample)

eststo: quietly: ivreg2  	errorLTGB	fitrevision L1LTG		, bw(61) small robust
	predict fiterror if e(sample)
eststo: quietly: ivreg2  	r5 		(errorLTGB=fiterror L1LTG)	, bw(61) small robust
	weakivtest	
weakiv ivregress 2sls 		r5 		(errorLTGB=fiterror L1LTG)	, vce(hac nw 61) small md
*********
esttab					,  nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) nolabel stats(N r2_a rkf)	 
esttab using $Tables/AppendixB6.csv	,  nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) drop(_cons) stats(N r2_a rkf) nogap title("Appendix B6") 	replace
*********
drop fitrevision fiterror
eststo clear
tsset datem

eststo clear
eststo  top1: quietly ivreg2  	errorLTG3 	d1LTG L1LTG		, bw(37) robust
eststo  top2: quietly ivreg2  	errorLTGB 	d1LTG L1LTG		, bw(61) robust
eststo  top3: quietly ivreg2  	errorLTG7 	d1LTG L1LTG		, bw(85) robust
esttab top*,  nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) nolabel stats(N r2_a)	 

esttab top* using $Tables/Footnote17.csv, nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) nogap drop(_cons) stats(N r2_a) title("Footnote 17") replace
*************************************
* Appendix D1 
* NOTE:  coefficient for e_cae3 is slightly off relative to printed version --> normalized over different period (same t-stats)
* Note: Version in the paper uses "ivreg2" command.  Here i am using "newey2" --> minor differences in the standard errors.
*************************************
eststo clear
quietly: 	 	regress r5 d1LTG L1LTG  e_cae3 		, robust
local r2_a=e(r2_a)
quietly: eststo: 	newey2  r5 d1LTG L1LTG  e_cae3 		, lag(60) force
estadd scalar ar2=`r2_a'
esttab *				, drop(_cons) nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) scalar(ar2) nogap 
esttab using $Tables/AppendixD1_col1.csv, drop(_cons) nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) scalar(ar2) nogap title("Appendix D1 (col[1])") replace
*************************************
* Appendix B7-- Unbundling
*************************************
use datem LTG LTG_Nagel r1 r3 r5 Actual* errorLTG* errorSTG* e_cae3 ST* CAPE ep dp fcastE1 fcastE2 eNIC*  if dofm(datem)>=mdy(12,1,1981) using /srv/Feb2023/TimeSeries01, clear

tsset datem
gen  errorLTG4=ln(L3.ActualE4/L3.ActualE0)/4-LTG if L3.ActualE0>0
keep if dofm(datem)>mdy(11,1,1981)

generate pd=-dp

foreach var of varlist error* ST* e_cae3 LTG pd CAPE eNIC* {
	egen `var'std=std(`var')
	replace `var'=`var'std
	drop `var'std
}
tsset datem
gen L1LTG=L12.LTG
gen d1LTG=LTG-L1LTG

forvalues x=12(12)60 {
	gen F`x'dLTG=F`x'.d1LTG 
}
keep if dofm(datem)<mdy(1,1,2016)
keep if r1+r5<.
* *************
preserve
local X1 "F12dLTG eNIC1"
local X3 "F12dLTG F24dLTG F36dLTG eNIC1 eNIC2 eNIC3"
local X5 "F12dLTG F24dLTG F36dLTG F48dLTG F60dLTG eNIC1 eNIC2 eNIC3 eNIC4 eNIC5"

keep if dp+r1+r3+r5+F12dLTG+F24dLTG+F36dLTG+F48dLTG+F60dLTG<.
keep if eNIC1+eNIC2+eNIC3+eNIC4+eNIC5<.

foreach var of varlist r1 r3 r5  {
	egen `var'std=std(`var')
	replace `var'=`var'std if `var'<.
	drop `var'std
}
* first stage regressions
eststo clear
quietly: eststo: ivreg2  r1 	`X1' 	, robust small bw(13)
predict res1 if e(sample), res

quietly: eststo: ivreg2  r3 	`X3' 	, robust small bw(37)
predict res3 if e(sample), res

quietly: eststo: ivreg2  r5 	`X5' 	, robust small bw(61)
predict res5 if e(sample), res

esttab, nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) nolabel stats(N r2 r2_a) drop(_cons)  nogaps order(F* eN*) 
esttab using $Tables/AppendixB7.csv, nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) nolabel stats(N r2 r2_a) drop(_cons)  nogaps order(F* eN*) title("Appendix B7") replace
*************************************
* Table 5-- Unbundling
*************************************
eststo clear
quietly: eststo: ivreg2  r1 	pd  	, robust small bw(13)
quietly: eststo: ivreg2  res1	pd  	, robust small bw(13)

quietly: eststo: ivreg2  r3 	pd  	, robust small bw(37)
quietly: eststo: ivreg2  res3 	pd  	, robust small bw(37)

quietly: eststo: ivreg2  r5	pd  	, robust small bw(61)
quietly: eststo: ivreg2  res5	pd  	, robust small bw(61)
esttab, b(4) se(4) compress
esttab using $Tables/Table5.csv, nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) nolabel stats(N r2 r2_a) drop(_cons)  nogaps title("Table 5") replace
restore
*************************************
* Appendix B8 -- Unbundling
*************************************
preserve
local X1 "eNIC1"
local X3 "eNIC1 eNIC2 eNIC3"
local X5 "eNIC1 eNIC2 eNIC3 eNIC4 eNIC5"

keep if eNIC1+eNIC2+eNIC3+eNIC4+eNIC5<.
keep if dp+r1+r3+r5<.
keep if eNIC1+eNIC2+eNIC3+eNIC4+eNIC5<.

foreach var of varlist r1 r3 r5  {
	egen `var'std=std(`var')
	replace `var'=`var'std if `var'<.
	drop `var'std
}
* first stage regressions
eststo clear
quietly: eststo: ivreg2  r1 	`X1' 	, robust small bw(13)
predict res1 if e(sample), res

quietly: eststo: ivreg2  r3 	`X3' 	, robust small bw(37)
predict res3 if e(sample), res

quietly: eststo: ivreg2  r5 	`X5' 	, robust small bw(61)
predict res5 if e(sample), res

esttab, nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) nolabel stats(N r2 r2_a) drop(_cons)  nogaps order(eN*) 
esttab using $Tables/AppendixB8.csv, nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) nolabel stats(N r2 r2_a) drop(_cons)  nogaps order(eN*) title("Appendix B8 -- Panel A") replace

eststo clear
quietly: eststo: ivreg2  r1 	pd  	, robust small bw(13)
quietly: eststo: ivreg2  res1	pd  	, robust small bw(13)

quietly: eststo: ivreg2  r3 	pd  	, robust small bw(37)
quietly: eststo: ivreg2  res3 	pd  	, robust small bw(37)

quietly: eststo: ivreg2  r5	pd  	, robust small bw(61)
quietly: eststo: ivreg2  res5	pd  	, robust small bw(61)
esttab, b(4) se(4)
esttab using $Tables/AppendixB8.csv, nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) nolabel stats(N r2 r2_a) drop(_cons)  nogaps title("Appendix B8 -- Panel B") append
restore
